import request from '@/utils/request'

// 获取教师列表
export function getTeacherList(params) {
  return request({
    url: '/api/teacher/list',
    method: 'get',
    params
  })
}

// 获取教师详情
export function getTeacherDetail(id) {
  return request({
    url: `/api/teacher/${id}`,
    method: 'get'
  })
}

// 获取教师课程
export function getTeacherCourses(id) {
  return request({
    url: `/api/teacher/${id}/courses`,
    method: 'get'
  })
}

// 获取教师资料
export function getTeacherMaterials(id) {
  return request({
    url: `/api/teacher/${id}/materials`,
    method: 'get'
  })
}

// 获取教师评价
export function getTeacherReviews(id, params) {
  return request({
    url: `/api/teacher/${id}/reviews`,
    method: 'get',
    params
  })
}

// 提交教师评价
export function submitTeacherReview(id, data) {
  return request({
    url: `/api/teacher/${id}/reviews`,
    method: 'post',
    data
  })
}

// 关注/取消关注教师
export function toggleFollowTeacher(id, isFollow) {
  return request({
    url: `/api/teacher/${id}/follow`,
    method: 'post',
    data: { isFollow }
  })
}

// 获取教师问答列表
export function getTeacherQuestions(id, params) {
  return request({
    url: `/api/teacher/${id}/questions`,
    method: 'get',
    params
  })
}

// 提交问题给教师
export function submitQuestion(id, data) {
  return request({
    url: `/api/teacher/${id}/questions`,
    method: 'post',
    data
  })
}

export default {
  getTeacherList,
  getTeacherDetail,
  getTeacherCourses,
  getTeacherMaterials,
  getTeacherReviews,
  submitTeacherReview,
  toggleFollowTeacher,
  getTeacherQuestions,
  submitQuestion
} 